package org.x.casemodule.commom;

import org.x.casemodule.entity.LegalCaseEntity;

import java.util.HashMap;
import java.util.Map;

public class TemplateFiller {

    public static String fillTemplate(String templateContent, LegalCaseEntity legalCase) {
        // 构建替换数据
        Map<String, String> data = new HashMap<>();
        data.put("${caseNo}", legalCase.getCaseNo());
        data.put("${title}", legalCase.getTitle());
        data.put("${description}", legalCase.getDescription());
        // 其他字段...

        // 执行替换
        String result = templateContent;
        for (Map.Entry<String, String> entry : data.entrySet()) {
            result = result.replace(entry.getKey(), entry.getValue());
        }

        return result;
    }
}
